import { Base } from '../../utils/base.js'

class Packet extends Base {

  constructor() {
    super();
  }
  //生成红包
  send(param, callback) {
    var allParams = {
      url: 'hongbao/send',
      data: param,
      type: 'Post',
      sCallback: function (data) {
        callback && callback(data);
      }
    };
    this.request(allParams);
  }
  //领取红包
  receive(param, callback) {
    var allParams = {
      url: 'hongbao/receive',
      data: param,
      type: 'Post',
      sCallback: function (data) {
        callback && callback(data);
      }
    };
    this.request(allParams);
  }
  //发红包记录
  sendRecord(param, callback) {
    var allParams = {
      url: 'hongbao/send-record?page='+param.page,
      data: param,
      type: 'Post',
      sCallback: function (data) {
        callback && callback(data);
      }
    };
    this.request(allParams);
  }
  //收红包记录
  receiveRecord(param, callback) {
    var allParams = {
      url: 'hongbao/receive-record?page=' + param.page,
      data: param,
      type: 'Post',
      sCallback: function (data) {
        callback && callback(data);
      }
    };
    this.request(allParams);
  }
  //红包详情
  detail(param, callback) {
    var allParams = {
      url: 'hongbao/detail',
      data: param,
      type: 'Post',
      sCallback: function (data) {
        callback && callback(data);
      }
    };
    this.request(allParams);
  }
}

export { Packet };